home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / modules / image.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2004-06-24  |  2.2 KB  |  91 lines

  1. function loadImage(mc, node, extrapath)
  2. {
  3.    var _loc3_ = extrapath;
  4.    if(_loc3_ == null)
  5.    {
  6.       _loc3_ = "";
  7.    }
  8.    var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
  9.    var _loc1_ = node.firstChild.nodeValue;
  10.    var _loc2_ = node.attributes.path;
  11.    if(_loc2_ != null)
  12.    {
  13.       _loc1_ = _loc2_ + _loc1_;
  14.    }
  15.    else
  16.    {
  17.       _loc1_ = strDefaultPath + _loc3_ + _loc1_;
  18.    }
  19.    if(strPathPrefix == null)
  20.    {
  21.       strPathPrefix = "";
  22.    }
  23.    mc.loadMovie(strPathPrefix + _loc1_);
  24. }
  25. function init()
  26. {
  27.    build();
  28. }
  29. function build()
  30. {
  31.    var _loc1_ = Tardis.Colors;
  32.    DEFAULT_COLOR = _loc1_.getHex("default");
  33.    imageToLoad = nodeData.byName("image");
  34.    loadImage(this.mc_image,imageToLoad);
  35.    intervalID = setInterval(this,"checkLoad",300);
  36. }
  37. function checkLoad()
  38. {
  39.    var _loc1_ = this;
  40.    if(_loc1_.mc_image._width > 0)
  41.    {
  42.       var _loc3_ = nodeData.byName("note");
  43.       if(_loc3_.getText() != null)
  44.       {
  45.          _loc1_.noteFF.htmlText = nodeData.byName("note").getText();
  46.          _loc1_.noteFF._x = _loc1_.mc_image._width;
  47.          _loc1_.noteFF._y = _loc1_.mc_image._height + 2;
  48.          _loc1_.noteFF.textColor = DEFAULT_COLOR;
  49.          _loc1_.noteFF.autosize = left;
  50.       }
  51.       var _loc2_ = nodeData.byName("caption").getText();
  52.       if(_loc2_ != null)
  53.       {
  54.          _loc1_.captionFF.htmlText = _loc2_;
  55.          _loc1_.captionFF._y = _loc1_.mc_image._height + 3;
  56.          _loc1_.captionFF.textColor = DEFAULT_COLOR;
  57.       }
  58.       clearInterval(intervalID);
  59.       _loc1_._visible = true;
  60.       _loc1_.mc_image._visible = true;
  61.    }
  62.    else
  63.    {
  64.       imgCounter++;
  65.       if(imgCounter == 20)
  66.       {
  67.          loadImage(_loc1_.mc_image,imageToLoad);
  68.          imgCounter = 0;
  69.       }
  70.    }
  71. }
  72. _visible = false;
  73. var onComplete = null;
  74. var imgCounter = 0;
  75. this.onUnload = function()
  76. {
  77.    clearInterval(intervalID);
  78. };
  79. mc_image.onLoad = function()
  80. {
  81.    var _loc1_ = this;
  82.    _loc1_._parent._visible = true;
  83.    if(_loc1_._parent.nodeData.attributes.flash == "true")
  84.    {
  85.       _loc1_._parent.play();
  86.    }
  87.    _parent.onComplete();
  88. };
  89. stop();
  90. onReady();
  91.